<?php
class Register_pacient_model extends CI_Model {

	function register()
	{
		$data = array(
			'Meno' => $_POST['Meno'],
			'Priezvisko' => $_POST['Priezvisko'],
			'Rodne_cislo' => $_POST['Rodne_cislo'],
			'Uzivatelske_meno' => $_POST['Uzivatelske_meno'],
			'Heslo' => $_POST['Heslo'],
			'Krvna_skupina' => $_POST['Krvna_skupina'],
			'Pohlavie' => $_POST['Pohlavie'],
			'Dieta' => $_POST['Dieta'],
			'Diagnoza' => $_POST['Diagnoza'],

		);
		
		$this->db->insert('Pacient', $data);
		
		$data = array(
			'Rodne_cislo' => $_POST['Rodne_cislo'],
			'Oddelenie' => $this->session->userdata('Oddelenie'),
	);
	
	   return $this->db->insert('Ubytovany', $data);
		
	}
	
	function zoznam_diet()
	{
		$this->db->select('Meno, ID');

        $query = $this->db->get('Dieta');
		
		  return $query->result_array();
	}
	
	
	function zoznam_rodnych_cisel_pacientov()
	{
		$this->db->select('Rodne_cislo');

        $query = $this->db->get('Pacient');
		
		  return $query->result_array();
	}
	
		function zoznam_uziv_mien_pacientov()
	{
		$this->db->select('Uzivatelske_meno');

        $query = $this->db->get('Pacient');
		
		  return $query->result_array();
	}
}